package View;

import java.awt.Color;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import kdiapo.CreationFrame;
import kdiapo.Main;

public class GestureView extends JPanel {
	private JLabel lbImage;
	private ImageIcon icon;
	private int numGest;
	private String type;
	private CreationFrame mainFrame;
	private String roleName;
	private boolean selected;
	
	public GestureView(String path,int numGest,String role,boolean s,String t,CreationFrame f){
		mainFrame = f;
		icon = new ImageIcon(Main.class.getResource(path));
		lbImage = new JLabel();
		lbImage.setIcon(icon);
		this.numGest= numGest;
		this.roleName = role;
		this.selected = s;
		this.type = t;
		
		this.setBorder(BorderFactory.createLineBorder(Color.gray));
		
		this.add(lbImage);
		
		addListeners();
	}

	public void addListeners(){
		
		this.addMouseListener(new MouseListener() {
			
			public void mouseReleased(MouseEvent e) {}
			
			public void mousePressed(MouseEvent e) {}
			
			public void mouseExited(MouseEvent e) {}
			
			public void mouseEntered(MouseEvent e) {}
			
			public void mouseClicked(MouseEvent e) {
				setBorder(BorderFactory.createLineBorder(Color.gray));
				System.out.println("Click choice gesture");
				selected=true;
				mainFrame.getModel().setGestSelection(type,roleName,numGest);
			}
		});
	}

	public JLabel getLbImage() {
		return lbImage;
	}

	public void setLbImage(JLabel lbImage) {
		this.lbImage = lbImage;
	}

	public ImageIcon getIcon() {
		return icon;
	}

	public void setIcon(ImageIcon icon) {
		this.icon = icon;
	}

	public int getNumGest() {
		return numGest;
	}

	public void setNumGest(int numGest) {
		this.numGest = numGest;
	}

	public CreationFrame getMainFrame() {
		return mainFrame;
	}

	public void setMainFrame(CreationFrame mainFrame) {
		this.mainFrame = mainFrame;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public boolean isSelected() {
		return selected;
	}

	public void setSelected(boolean selected) {
		this.selected = selected;
	}
	
	
}
